package com.itheima.localdatatimeutil;

import java.time.LocalDateTime;

public class Demo_LocalDateTime {
    public static void main(String[] args) {
        LocalDateTime localDateTime = LocalDateTime.now();
        String s1 = MyLocalDateTimeUtil.localDateTimeToString(localDateTime);
        System.out.println(s1);
        System.out.println("-----------------------");
        String s2 = MyLocalDateTimeUtil.localDateTimeToString(localDateTime, "yyyy/MM/dd HH:mm:ss");
        System.out.println(s2);
        System.out.println("-----------------------");
        String a = "2020-11-11 11:11:11";
        LocalDateTime t1 = MyLocalDateTimeUtil.stringToLocalTimeDate(a);
        System.out.println(t1);
        System.out.println("-----------------------");
        LocalDateTime t2 = MyLocalDateTimeUtil.stringToLocalTimeDate(a, "yyyy-MM-dd HH:mm:ss");
        System.out.println(t2);
        System.out.println("-----------------------");
        long between = MyLocalDateTimeUtil.millisecondBetween(localDateTime, t1);
        System.out.println(between);
    }
}
